<template>
  <div id="app">
    <p :style="{width:getWidth}"  style='border: 1px solid black'>我是子组件mycom2</p>
  </div>
</template>

<script>
export default {
      props: ["childWidth"],
      computed: {
        getWidth(){
          return this.childWidth + "px"; //400px
        },
      },
}
</script>

<style>
</style>